﻿using System;
using System.Configuration;
using System.Drawing;
using System.Drawing.Printing;
using System.Windows.Forms;
using Billing.Utilities;

namespace Billing
{
    public partial class BulkOrderDeliveryPrinter : Form
    {
        PaperSize psize;
        string billNo;
        string amount;

        public BulkOrderDeliveryPrinter(string billNo, string amount)
        {
            InitializeComponent();
            this.billNo = billNo;
            this.amount = amount;
        }

        private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
        {
            e.PageSettings.PaperSize = psize;
            e.Graphics.DrawString("KS BAKERS", new Font(new FontFamily("Times New Roman"), 10, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 100, 0);
            e.Graphics.DrawString(ConfigurationManager.AppSettings["ColonyName"], new Font(new FontFamily("Times New Roman"), 9, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 15, 13);
            e.Graphics.DrawString(ConfigurationManager.AppSettings["TinNo"], new Font(new FontFamily("Times New Roman"), 9, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 80, 26);
            e.Graphics.DrawString("Date : " + DateTime.Now.ToString("dd/MM/yy") + "  " + DateTime.Now.ToShortTimeString() + " Cashier : " + Storage.LoginUserName, new Font(new FontFamily("Times New Roman"), 9, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 9, 45);

            e.Graphics.DrawString("Bulk Order Bill No : " + billNo, new Font(new FontFamily("Times New Roman"), 12, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 8, 70);
            e.Graphics.DrawString("Balance Amount Paid : " + amount + " /-", new Font(new FontFamily("Times New Roman"), 12, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 8, 100);

            e.Graphics.DrawString("Your order will take 5-10 minutes. Please wait...", new Font(new FontFamily("Times New Roman"), 9, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.Black, 30, 260);
            e.Graphics.RotateTransform(-45);
            e.Graphics.DrawString("BULK ORDER BALANCE", new Font(new FontFamily("Times New Roman"), 25, System.Drawing.FontStyle.Regular), System.Drawing.Brushes.LightSlateGray, -200, 200);
            e.Graphics.ResetTransform();
        }

        private void printDocument1_QueryPageSettings(object sender, System.Drawing.Printing.QueryPageSettingsEventArgs e)
        {
            psize = new PaperSize("saurabh", 300, 300);
            e.PageSettings.PaperSize = psize;
        }
    }
}
